﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using HNQXYJ.Model;
using HNQXYJ.DAL;
namespace HNQXYJ.BLL
{
    public class AreaGroupBLL
    {
          /// <summary>
        /// 获取areaCode的最大值 如果返回-1说明表中还没有这个权限下的分组
       /// </summary>
       /// <param name="ranklevel"></param>
       /// <returns></returns>
        public int GetAreaCodeMax(string ranklevel)
        {
            int areaCode = new AreaGroupDAL().GetAreaCodeMax(ranklevel);
            return areaCode;
            
        }

         /// <summary>
        /// 向分组表中添加数据
        /// </summary>
        /// <param name="ag"></param>
        /// <returns></returns>
        public int AddNewGroup(AreaGroup ag)
        {
            int res = new AreaGroupDAL().AddNewGroup(ag);
            return res;
        }

         /// <summary>
        /// 根据权限码回去分组列表
        /// </summary>
        /// <param name="ranklevel"></param>
        /// <returns></returns>
        public List<AreaGroup> GetListByRankLevel(string ranklevel)
        {
            List<AreaGroup> list = new AreaGroupDAL().GetListByRankLevel(ranklevel);
            return list;
        }

        /// <summary>
        /// 根据id删除数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DeleteDataById(int id)
        {
            int res = new AreaGroupDAL().DeleteDataById(id);
            return res;
        }

         /// <summary>
        /// 根据id获取用户对象
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public AreaGroup GetDataById(int id)
        {
            AreaGroup ag=new AreaGroupDAL().GetDataById(id);
            return ag;
        }

           /// <summary>
        /// 根据id更新数据
        /// </summary>
        /// <param name="ag"></param>
        /// <returns></returns>
        public int UpdateById(AreaGroup ag)
        {
            int res = new AreaGroupDAL().UpdateById(ag);
            return res;
        }

    }
}